# 1.
def sum(n):
    res = 0
    while n >= 1:
        if n & 1:
            res += 1.0/(n*(n+1))
        else:
            res -= 1.0/(n*(n+1))
        n -= 1
    return res
num = int(input('输入一个数字：'))
ret = sum(num)
print(ret)


# 2
def is_palindrome(n):
    n=str(n)
    m=n[::-1]
    return n==m
num = (input("输入一个数字:"))
result = is_palindrome(num)
print(result)


# 3
a, b , c = map(int, input('输入三个数字，用 , 隔开').split(','))
if a + b > c and a + c > b and b + c > a:
    print('可以构成三角形')
else:
    print('不能构成三角形')

# 4
def llcm(x,y):
    i = max(x,y)
    while i <= x * y:
        if not (i % x or i % y):
            return i
        i += 1
a, b= map(int, input('输入个数字，用 , 隔开').split(','))
print( a,"和", b,"的最小公倍数为", llcm(a, b))


# 5
import math
def lcm(x,y):
    i = 2
    while i <= math.sqrt(x):
        if not (x % i or y % i):
            return i
        i += 1

a, b= map(int, input('输入个数字，用 , 隔开').split(','))
print( a,"和", b,"的最小公倍数为", lcm(a, b))